/**
 * 日期格式工具
 * @author 木人心
 * @version 1.0.0
 */
import m from 'moment'
import 'moment/dist/locale/zh-cn'
m.locale('zh-cn')

/* eslint-disable */
export enum DateFormat {
  Time = 'HH:mm:ss',
  Date = 'YYYY-MM-DD',
  DateTime = 'YYYY-MM-DD HH:mm:ss'
}

/* eslint-disable */

/**
 * 获取近几天
 * @param day
 */
export function recentDate (day: number): [string, string] {
  const today = m().format(DateFormat.Date)
  const before = m().add(-day, 'days').format(DateFormat.Date)
  return [before, today]
}

export const moment = m
